import 'package:shared_preferences/shared_preferences.dart';

Future saveString(String key, String value) async {
  SharedPreferences preferences = await SharedPreferences.getInstance();
  preferences.setString(key, value);
  print("save: $key==>$value");
}
Future saveInt(String key, int value) async {
  SharedPreferences preferences = await SharedPreferences.getInstance();
  preferences.setInt(key, value);
}
Future saveBoolean(String key, bool value) async {
  SharedPreferences preferences = await SharedPreferences.getInstance();
  preferences.setBool(key, value);
}
Future getBoolean(String key) async {
  SharedPreferences preferences = await SharedPreferences.getInstance();
  return preferences.getBool(key);
}
Future getString(String key) async {
  SharedPreferences preferences = await SharedPreferences.getInstance();
  return preferences.getString(key);
}
Future getInt(String key) async {
  SharedPreferences preferences = await SharedPreferences.getInstance();
  return preferences.getInt(key);
}
/*
   * 删除数据
   */
Future delByKey(String key) async {
  SharedPreferences preferences = await SharedPreferences.getInstance();
  preferences.remove(key);
}
